package com.jyw.business.obstacles.domain.vo.wechat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jyw.common.constant.SysDictTypeConstant;
import com.jyw.business.obstacles.domain.ObsOrderFault;
import com.jyw.business.obstacles.domain.vo.web.OrderFaultVO;
import com.jyw.common.annotation.Conversion;
import com.jyw.common.annotation.Excel;
import com.jyw.common.enums.ConversionType;
import com.jyw.common.utils.bean.BeanUtils;
import com.jyw.system.domain.vo.SimpleFileVo;
import com.jyw.system.utils.FileUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.FieldNameConstants;

import java.util.Date;
import java.util.List;

/**
 * @author Created by ZhangCheng on 2023/09/07
 */
@Data
@ApiModel("微信工单故障信息")
@NoArgsConstructor
@FieldNameConstants
public class WxWorkOrderFaultVO {

    /** 工单来源*/
    @ApiModelProperty("工单来源")
    private Integer source;


    /** 故障分类 */
    @ApiModelProperty("故障分类")
    @Conversion(value = ConversionType.DICT,dictType = SysDictTypeConstant.OBS_FAULT_TYPE)
    private String faultType;

    @ApiModelProperty("故障分类名称")
    private String faultTypeToName;

    /** 故障描述 */
    @ApiModelProperty("故障描述")
    private String faultRemark;

    /** 紧急程度 */
    @ApiModelProperty("紧急程度")
    @Conversion(value = ConversionType.DICT,dictType = SysDictTypeConstant.OBS_FAULT_DEGREE)
    private Integer degree;

    @ApiModelProperty("紧急程度标签")
    private String degreeToName;

    /** 影响范围 */
    @ApiModelProperty("影响范围")
    @Conversion(value = ConversionType.DICT,dictType = SysDictTypeConstant.OBS_FAULT_RANGE)
    private Integer rangeType;

    @ApiModelProperty("影响范围标签")
    private String rangeTypeToName;

    /** 响应类型 */
    @ApiModelProperty("响应类型")
    @Conversion(value = ConversionType.DICT,dictType = SysDictTypeConstant.OBS_FAULT_RESPONSE)
    private Integer responseType;

    @ApiModelProperty("响应类型标签")
    private String responseTypeToName;

    @ApiModelProperty("预约时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date appointment;

    /** 预计工时 */
    @ApiModelProperty("预计工时")
    private Integer reqTime;

    /** 附件 */
    @ApiModelProperty("附件")
    private List<SimpleFileVo> enclosure;


    /** 期望完成时间 */
    @ApiModelProperty("期望完成时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date completeTime;

    /** 创建人(创建人) */
    @ApiModelProperty("建单人")
    private Long createUser;


    /** 创建时间(创建时间) */
    @ApiModelProperty("建单时间")
    private Date createTime;

    /** 实际报修地址 */
    @ApiModelProperty("实际报修地址")
    @Excel(name = "实际报修地址")
    @Conversion(value = ConversionType.DEPT,name = OrderFaultVO.Fields.actualRepairPlaceToName)
    private Long actualRepairPlace;

    @ApiModelProperty("实际报修地址名称")
    private String actualRepairPlaceToName;

    /** 故障设备 */
    @ApiModelProperty("资产名称")
    private String equipment;

    /** 故障设备位置 */
    @ApiModelProperty("资产位置")
    private String equipmentAddress;

    /** 故障设备位置id */
    @ApiModelProperty(value = "资产位置id",hidden = true)
    private Long equipmentAddressId;

    @ApiModelProperty(value = "处理人")
    @Conversion(value = ConversionType.USER,name = OrderFaultVO.Fields.makeUserName)
    private Long makeUser;

    @ApiModelProperty("处理人名称")
    private String makeUserName;

    public WxWorkOrderFaultVO(ObsOrderFault fault) {
        BeanUtils.copyProperties(fault,this);
        setEnclosure(FileUtils.IdToFile(fault.getEnclosureId()));
    }
}
